<?php

class Input_Login extends \SF\Input
{
    public function init()
    {   
        // 用户名
        $this->addItem('username', array(
            'filters' => array('stringTrim', 'deQuote'),
            'validators' => array(
                array('validator' => 'notEmpty', 'message' => '用户名不能为空'),
            ),
        ));

        // 密码
        $this->addItem('password', array(
            'filters' => array('stringTrim', 'deQuote'),
            'validators' => array(
                array('validator' => 'notEmpty', 'message' => '密码不能为空'),
            ),
        ));

        // 验证码
        $this->addItem('vcode', array(
            'filters' => array('stringTrim', 'stringToLower'),
            'validators' => array(
                array('validator' => 'notEmpty', 'message' => '验证码不能为空'),
                array('validator'=>'isEqual', 'options'=>array(strtolower($_SESSION['seccode'])), 'message'=>'验证码错误'),
            ),
        ));
    }

}